

//Quicktime player options
var qtloop = 'false' // Loop Quicktime movies: true or false.
var qtwidth = '400' // Width of your Quicktime player
var qtheight = '316' // Height of your Quicktime player (allow 16px for controller)
var qtkiosk = 'false' // Allow downloads, false = yes, true = no.
// Required Quicktime version - To set the minimum version higher than 6 go to Quicktime player section below and edit (quicktimeVersion >= 6) on or around lines 228 and 266.

//WMV player options
var wmvwidth = '400' // Width of your WMV player
var wmvheight = '372' // Height of your WMV player (allow 45px for WMV controller or 16px if QT player - ignored by WinIE)







/* ----------------------- Quicktime player ------------------------ */

function quicktimePlayer(all){
	for (var i = 0, o; o = all[i]; i++) {			
			var url = o.innerHTML;			
			o.innerHTML = '<embed src="'+url+'" width="'+qtwidth+'" height="'+qtheight+'" loop="'+qtloop+'" autoplay="true" controller="true" border="0" type="video/quicktime" kioskmode="'+qtkiosk+'" scale="tofit"></embed>';
			o.style.display = '';
		}
	
}

function setVideoPlayer(){
		
	var all = document.getElementsByClassName('video-mp4');
	quicktimePlayer(all);
	all = document.getElementsByClassName('video-mov');
	quicktimePlayer(all);
	all = document.getElementsByClassName('video-quicktime');
	quicktimePlayer(all);
	all = document.getElementsByClassName('video-m4v');
	quicktimePlayer(all);
	all = document.getElementsByClassName('video-m4b');
	quicktimePlayer(all);
	all = document.getElementsByClassName('video-3gp');
	quicktimePlayer(all);
	all = document.getElementsByClassName('video-3gpp');
	quicktimePlayer(all);
	
	all = document.getElementsByClassName('video-asf');
	windowsMediaPlayer(all);
	all = document.getElementsByClassName('video-x-ms-asf');
	windowsMediaPlayer(all);
	all = document.getElementsByClassName('video-avi');
	windowsMediaPlayer(all);
	all = document.getElementsByClassName('video-x-msvideo');
	windowsMediaPlayer(all);
	all = document.getElementsByClassName('video-wmv');
	windowsMediaPlayer(all);
	all = document.getElementsByClassName('video-x-ms-wmv');
	windowsMediaPlayer(all);
	all = document.getElementsByClassName('video-mpeg');
	windowsMediaPlayer(all);
	all = document.getElementsByClassName('video-mpg');
	windowsMediaPlayer(all);
	
}

/* ----------------------- WMV player -------------------------- */

function windowsMediaPlayer(all){		
	for (var i = 0, o; o = all[i]; i++) {
		var url = o.innerHTML;	
	 if(navigator.userAgent.indexOf('Mac') != -1) {
		 o.innerHTML =  '<embed src="'+url+'" width="'+qtwidth+'" height="'+qtheight+'" loop="'+qtloop+'" autoplay="true" controller="true" border="0" type="video/quicktime" kioskmode="'+qtkiosk+'" scale="tofit" pluginspage="http://www.apple.com/quicktime/download/"></embed>';
	 
	 } else {
		 if (navigator.plugins && navigator.plugins.length) {
			 o.innerHTML = '<embed type="application/x-mplayer2" src="'+url+'" ' +
		 'showcontrols="1" ShowStatusBar="1" autostart="1" displaySize="4"' +
		 'pluginspage="http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/"' +
		 'width="'+wmvwidth+'" height="'+wmvheight+'">' +
		 '</embed>';
		 
		 } else {
			 o.innerHTML =  '<object classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" width="'+wmvwidth+'" height="'+wmvheight+'" id="player"> ' +
		 '<param name="url" value="'+url+'" /> ' +
		 '<param name="autoStart" value="True" /> ' +
		 '<param name="stretchToFit" value="True" /> ' +
		 '<param name="showControls" value="True" /> ' +
		 '<param name="ShowStatusBar" value="True" /> ' +
		 '<embed type="application/x-mplayer2" src="'+url+'" ' +
		 'showcontrols="1" ShowStatusBar="1" autostart="1" displaySize="4"' +
		 'pluginspage="http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/"' +
		 'width="'+wmvwidth+'" height="'+wmvheight+'">' +
		 '</embed>' +
		 '</object>';
		 
		 }
	 }
	 
	 o.style.display = '';
	}
}

/* ----------------- Trigger players onload ----------------------- */

$(document).ready(function() {
	setVideoPlayer();
	
});	
